package com.mavenlu.play;

import android.os.Bundle;

import com.mavenlu.play.base.webview.BaseWebActivity;
import com.mavenlu.play.base.webview.WrapWebView;

public class MainActivity extends BaseWebActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        loadIndex();
    }

    @Override
    protected String getUrl() {

        String s;

        //幸运抽奖
//        s="http://funbox.upush.cn/agent/funbox?appId=SDK20171427021015xfmt2czqj6sqb98&rdeviceId=__DEVICEID__";
        //免费抽奖
//        s="http://funbox.upush.cn/agent/funbox?appId=SDK20171110111131yn8u6mzne461wul&rdeviceId=__DEVICEID__";

//        超级寻宝
//        s="http://funbox.upush.cn/agent/funbox?appId=SDK20171220121101ov5w5xuwfbdkoid&rdeviceId=__DEVICEID__";
//        福利红包
//        s="http://funbox.upush.cn/agent/funbox?appId=SDK20171613041105374n0qoy564ms2c&rdeviceId=__DEVICEID__";
//        s="http://funbox.upush.cn/agent/funbox?appId=SDK20171613041105374n0qoy564ms2c&rdeviceId=__DEVICEID__";

//        s="http://funbox.upush.cn/agent/funbox?appId=SDK20171007101228rlsgp5u9dwzwwoo&rdeviceId=__DEVICEID__";
//        s="http://delight.bypush.com/agent/funbox?appId=SDK20171713051216n1jnjh0x4if5asc&rdeviceId=__DEVICEID__";


        //"com.mavenlu.g"  抢好运
//        s="http://interaction.bayimob.com/gameHtml?appkey=d28d296b68b6ac1232353531256488b3&adSpaceKey=140f6969d5213fd0ece03148e62e461e";
        //"com.mavenlu.h"  超级红包
//        s="http://interaction.bayimob.com/gameHtml?appkey=a052f1fccf47b66d047f2234c53f1597&adSpaceKey=b73ce398c39f506af761d2277d853a92";
        //"com.mavenlu.i"  福利宝箱
//        s = "http://interaction.bayimob.com/gameHtml?appkey=76bba5ee241042431796c97a92e64f5d&adSpaceKey=bd4c9ab730f5513206b999ec0d90d1fb";


//        s="file:///android_asset/testurl_iframe.html";


        //com.bj.kuaiweiyou 快微游
        s="http://h5.qkgames.cn/game/games/index.html";

        return s;
    }


    private long firstTime;

    @Override
    public void onBackPressed() {

        long secondTime = System.currentTimeMillis();
        if (secondTime - firstTime > 500) {
//            ToastUtil.show(getContext(), "连续按两次直接退出");
            firstTime = secondTime;
            webViewBack();
        } else {
            super.onBackPressed();
        }


    }

    private void webViewBack() {
        WrapWebView webView = getWebView();
        if (webView == null || !webView.canGoBack()) {
            super.onBackPressed();
        } else {
            webView.goBack();
        }
    }

}
